package cn.buglife.springboot.controller.mq;

import cn.buglife.springboot.bean.Bar;
import cn.buglife.springboot.bean.Foo;
import cn.buglife.springboot.service.Sender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by zhangjun on 15/11/30.
 */
@RequestMapping(value = "/mq")
@RestController
public class MQController {

    @Autowired
    private Sender sender;

    @RequestMapping(method = RequestMethod.GET)
    public Map send(){
        Foo foo = new Foo();
        foo.setName("harry");

        Bar bar = new Bar();
        bar.setAge(27);
        sender.sendToRabbitmq(foo,bar);

        Map map = new HashMap();
        map.put("success",true);

        return map;
    }
}
